const category = require('./category/index');
const detail = require('./detail/index');
const getOpenId = require('./getOpenId/index');
const getMiniProgramCode = require('./getMiniProgramCode/index');

// 云函数入口函数
exports.main = async (event, context) => {
  console.log("event:" + JSON.stringify(event));
  switch (event.type) {
    case 'category':
      return await category.main(event, context);
    case 'detail':
      return await detail.main(event, context);
    case 'getOpenId':
      return await getOpenId.main(event, context);
    case 'getMiniProgramCode':
      return await getMiniProgramCode.main(event, context);
    default:
      console.log("type " + event.type + "undefined")
  }
};
